package com.example.aslongastoday.ui.backlog;

import android.os.Bundle;

import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;

import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.aslongastoday.R;


public class ThemesChangeFragment extends Fragment implements View.OnTouchListener{

    private ImageView iv_back;
    private TextView tv_title;

    public ThemesChangeFragment() {
        // Required empty public constructor
    }

    public static ThemesChangeFragment newInstance(String param1, String param2) {
        ThemesChangeFragment fragment = new ThemesChangeFragment();
        Bundle args = new Bundle();
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (getArguments() != null) {

        }
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        final View view = inflater.inflate(R.layout.fragment_themes_change, container, false);

        //拦截touch请求, 防止泄露
        view.setOnTouchListener(this);

        //实例化控件
        iv_back = view.findViewById(R.id.iv_back);
        tv_title = view.findViewById(R.id.tv_title);

        //返回监听事件
        iv_back.setOnClickListener(new View.OnClickListener() {
            private FragmentManager fragmentManager;

            @Override
            public void onClick(View v) {
                //退出fragment
                fragmentManager = getActivity().getSupportFragmentManager();
                fragmentManager.popBackStack();
            }
        });

        tv_title.setText("主题色切换");


        //主题色切换






        return view;
    }

    // onTouch事件 将上层的触摸事件拦截
    @Override
    public boolean onTouch(View view, MotionEvent motionEvent) {
        return true;
    }

    //监听颜色
    public interface OnColorChangedListener {
        void onColorChanged(int color);
    }


}